local proto = require("src.kit.core.proto")
local path = require("src.kit.core.path")
local log = require("src.kit.core.log")

local logger = proto.class("logger")
logger.level = {}
logger.level.verbose = 0
logger.level.info = 1
logger.level.warn = 2
logger.level.error = 3

function logger:ctor()
    self.__log_verbose = log.new(logger.level.verbose)
    self.__log_info = log.new(logger.level.info)
    self.__log_warn = log.new(logger.level.warn)
    self.__log_error = log.new(logger.level.error)
end

function logger:v(msg) self.__log_verbose:push(msg) end

function logger:i(msg) self.__log_info:push(msg) end

function logger:w(msg) self.__log_warn:push(msg) end

function logger:e(msg) self.__log_error:push(msg) end

function logger:save()
    self.__log_verbose:save()
    self.__log_info:save()
    self.__log_warn:save()
    self.__log_error:save()
end

function logger:close()
    self.__log_verbose:close()
    self.__log_info:close()
    self.__log_warn:close()
    self.__log_error:close()
end

return logger
